﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision.LinearSystem
{
	public class SystemArrayWrapper<T> : IMultiDimensionalArray<T>
	{
		public T[,] WrappedArray { set { _wrappedArray = value; } }
		private T[,] _wrappedArray;
		public SystemArrayWrapper() { }
		public SystemArrayWrapper(T[,] array)
		{
			this.WrappedArray = array;
		}

		#region IMultiDimensionalArray<T> Members

		public T this[params int[] index]
		{
			get
			{
				return _wrappedArray[index[0],index[1]];
			}
			set
			{
				_wrappedArray[index[0], index[1]] = value;
			}
		}

		public int GetLength(int DimensinNumber)
		{
			return _wrappedArray.GetLength(DimensinNumber);
		}

		public int Dimension
		{
			get { return 2; }
		}

		#endregion

		public static implicit operator SystemArrayWrapper<T>(T[,] array)
		{
			return new SystemArrayWrapper<T>(array);
		}
	}
}
